Part Number Hot Search : 
FIN1002 5C100 TDA2006 IDT74L MB91F36 TG311RW TZM5226B BC846A
Product Description
Full Text Search
 

To Download T89C51CC020312 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 Features
* Protocol
- CAN Used as a Physical Layer - 7 ISP CAN Identifiers - Relocatable ISP CAN Identifiers - Autobaud * In-System Programming - Read/Write Flash and EEPROM Memory - Read Device ID - Full-chip Erase - Read/Write Configuration Bytes - Security Setting From ISP Command - Remote Application Start * In-Application Programming/Self-Programming - Read/Write Flash and EEPROM Memory - Read Device ID - Block Erase - Read/Write Configuration Bytes - Bootloader Start
CAN Microcontrollers
T89C51CC02 CAN Bootloader
Description
This document describes the CAN bootloader functionalities as well as the CAN protocol to efficiently perform operations on the on-chip Flash (EEPROM) memories. Additional information on the T89C51CC02 product can be found in the T89C51CC02 datasheet and the T89C51CC02 errata sheet available on the Atmel web site, www.atmel.com. The bootloader software package (source code and binary) currently used for production is available from the Atmel web site.
Bootloader Revision Revision 1.0.2
Purpose of Modifications First release
Date 14/12/2001
Rev. 4208C-CAN-12/03
1
Functional Description
In-System Programming Capability
The T89C51CC02 Bootloader facilitates In-System Programming and In-Application Programming. The ISP allows the user to program or reprogram a microcontroller on-chip Flash memory without removing it from the system and without the need of a pre-programmed application. The CAN bootloader can manage a communication with a host through the CAN network. It can also access and perform requested operations on the on-chip Flash memory.
In-Application Programming or Selfprogramming Capability
In-Application Programming (IAP) allows the reprogramming of a microcontroller onchip Flash memory without removing it from the system and while the embedded application is running. The CAN bootloader contains some Application Programming Interface routines named API routines allowing IAP by using the user's firmware.
Block Diagram
This section describes the different parts of the bootloader. Figure 1 shows the on-chip bootloader and IAP processes. Figure 1. Bootloader Process Description
On chip User Application
External Host via the CAN Protocol Communication
ISP Communication Management
IAP User Call Management
Flash Memory Management
Flash Memory
2
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
ISP Communication Management The purpose of this process is to manage the communication and its protocol between the on-chip bootloader and an external device (host). The on-chip bootloader implements a CAN protocol (see Section "Protocol", page 9). This process translates serial communication frames (CAN) into Flash memory accesses (read, write, erase...). Several Application Program Interface (API) calls are available to the application program to selectively erase and program Flash pages. All calls are made through a common interface (API calls) included in the bootloader. The purpose of this process is to translate the application request into internal Flash memory operations. This process manages low level accesses to the Flash memory (performs read and write accesses).
User Call Management
Flash Memory Management
Bootloader Configuration
Configuration and Manufacturer Information The following table lists Configuration and Manufacturer byte information used by the bootloader. This information can be accessed by the user through a set of API or ISP command.
Mnemonic BSB SBV P1_CF P3_CF P4_CF SSB EB CANBT1 CANBT2 CANBT3 NNB CRIS Manufacturer ID1: Family code ID2: Product Name ID3: Product Revision Description Boot Status Byte Software Boot Vector Port 1 Configuration Port 3 Configuration Port 4 Configuration Software Security Byte Extra Byte CAN Bit Timing 1 CAN Bit Timing 2 CAN Bit Timing 3 Node Number Byte CAN Relocatable Identifier Segment Default Value FFh FCh FEh FFh FFh FFh FFh FFh FFh FFh FFh FFh 58h D7h BBh FFh
3
4208C-CAN-12/03
Mapping and Default Value of Hardware Security Byte
The 4 Most Significant Bit (MSB) of the Hardware Byte can be read/written by software (this area is called Fuse bits). The 4 Least Significant Bit (LSB) can only be read by software and written by hardware in parallel mode (with parallel programmer devices).
Bit Position 7 6 5 4 3 2 1 0 Mnemonic X2B BLJB Reserved Reserved Reserved LB2 LB1 LB0 Default Value Description U P U U U P U U To lock the chip (see datasheet) To start in x1 mode To map the boot area in code area between F800h-FFFFh
Note:
U: Unprogram = 1 P: Program = 0
Security
The bootloader has Software Security Byte (SSB) to protect itself from user access or ISP access. The Software Security Byte (SSB) protects from ISP access. The command "Program Software Security Bit" can only write a higher priority level. There are three levels of security: * level 0: NO_SECURITY (FFh) This is the default level. From level 0, one can write level 1 or level 2. level 1: WRITE_SECURITY (FEh) In this level it is impossible to write in the Flash memory, BSB and SBV. The Bootloader returns ID_ERROR message. From level 1, one can write only level 2. level 2: RD_WR_SECURITY (FCh) Level 2 forbids all read and write accesses to/from the Flash memory. The Bootloader returns ID_ERROR message.
*
*
Only a full chip erase command can reset the software security bits.
Level 0 Flash/EEPROM Fuse bit BSB & SBV & EB SSB Manufacturer info Bootloader info Erase block Full-chip erase Blank Check Any access allowed Any access allowed Any access allowed Any access allowed Read only access allowed Read only access allowed Allowed Allowed Allowed Level 1 Read only access allowed Read only access allowed Read only access allowed Write level2 allowed Read only access allowed Read only access allowed Not allowed Allowed Allowed Level 2 All access not allowed All access not allowed All access not allowed Read only access allowed Read only access allowed Read only access allowed Not allowed Allowed Allowed
4
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
Software Boot Vector
The Software Boot Vector (SBV) forces the execution of a user bootloader starting at address [SBV]00h in the application area (FM0). The way to start this user bootloader is described in the section "Boot Process". Figure 2. Software Boot Vector
CAN Bootloader
FM1 Application User Bootloader [SBV]00h
FM0
FLIP Software Program
FLIP is a PC software program running under Windows(R) 9x/2000/XP, Windows NT and LINUX(R) that supports all Atmel Flash microcontroller and CAN protocol communication media. Several CAN dongles are supported by FLIP (for Windows). This software program is available free of charge from the Atmel web site.
5
4208C-CAN-12/03
In-System Programming (ISP)
The ISP allows the user to program or reprogram a microcontroller's on-chip Flash memory through the CAN network without removing it from the system and without the need of a pre-programmed application. This section describes how to start the CAN bootloader and all higher level protocols over the CAN.
Boot Process
The bootloader can be activated in two ways: * * Hardware condition Regular boot process
Hardware Condition
The Hardware Condition forces the bootloader execution from reset. The default factory Hardware Condition is assigned to port P1. * P1 must be equal to FEh In order to offer the best flexibility, the user can define its own Hardware Condition on one of the following Ports: * * * Port1 Port3 Port4 (only bit0 and bit1)
The Hardware Condition configuration are stored in three bytes called P1_CF, P3_CF, P4_CF. These bytes can be modified by the user through a set of API or through an ISP command. There is a priority between P1_CF, P3_CF and P4_CF (see Figure 3 on page 7).
Note: The BLJB must be at 0 (programmed) to be able to restart the bootloader. If the BLJB is equal to 1 (unprogrammed) only the hardware parallel programmer can change this bit (see T89C51CC02 datasheet for more details).
6
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
Figure 3. Regular Boot Process
RESET
Hardware Boot Process
Bit ENBOOT in AUXR1 Register is Initialized with BLJB Inverted
ENBOOT = 0 PC = 0000h
Yes
BLJB = 1 ENBOOT = 1 PC = F800h
No No
P1_CF = FFh No
Yes
No
P1_CF = P1 Yes
P3_CF = FFh
Yes
Software Boot Process
No
P3_CF = P3 Yes
No
P4_CF = FFh
Yes
No
P4_CF = P4
Yes
BSB = 0
Yes
No No
SBV < 3Fh Yes
Start Application
Start User Bootloader
Start Bootloader
7
4208C-CAN-12/03
Physical Layer
The CAN is used to transmit information has the following configuration: * * * Standard Frame CAN format 2.0A (identifier 11-bit) Frame: Data Frame Baud rate: autobaud is performed by the bootloader
CAN Controller Initialization
Two ways are possible to initialize the CAN controller: * * * * Use the software autobaud Use the user configuration stored in the CANBT1, CANBT2 and CANBT3 EB = FFh: the autobaud is performed. EB not equal to FFh: the CANBT1:2:3 are used.
The selection between these two solutions is made with EB:
CANBT1:3 and EB can be modified by user through a set of API or with ISP commands. The figure below describes the CAN controller flow. Figure 4. CAN Controller Initialization
CAN Controller Initialization
EB = FFh No Read CANBT1 Value Read CANBT2 Value Read CANBT3 Value
Yes
CANBTx = FFh x = (1,3) No Configure the CAN Controller
Yes
CAN Error
Yes Set the CAN Controller in Autobaud Mode
No
Autobaud OK Yes
No
CAN Macro Initialized
8
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
CAN Autobaud The following table shows the autobaud performance for a point-to-point connection in X1 mode.
8 MHz 20K 100K 125K 250K 500K 1M 11.059 MHz 12 MHz 16 MHz 20 MHz 22.1184 MHz 24 MHz 25 MHz 32 MHz 40 MHz
-
- -
-
-
-
Note:
1. `-' Indicates impossible configuration.
CAN Autobaud Limitation
The CAN Autobaud implemented in the bootloader is efficient only in point-to-point connection. Because in a point-to-point connection, the transmit CAN message is repeated until a hardware acknowledge is done by the receiver. The bootloader can acknowledge an incoming CAN frame only if a configuration is found. This functionality is not guaranteed on a network with several CAN nodes.
Protocol
Generic CAN Frame Description
Identifier 11-bit
Control 1 byte
Data 8 bytes max
* * *
Identifier: Identifies the frame (or message). Only the standard mode (11-bit) is used. Control: Contains the DLC information (number of data in Data field) 4-bit. Data: The data field consists of zero to eight bytes. The interpretation within the frame depends on the Identifier field.
To describe the ISP CAN Protocol, we use Symbolic name for Identifier, but default values are given.
The CAN Protocol manages directly using hardware a checksum and an acknowledge.
Note:
Command Description
This protocol allows to: * * * * * * * Initialize the communication Program the Flash or EEPROM Data Read the Flash or EEPROM Data Program Configuration Information Read Configuration and Manufacturer Information Erase the Flash Start the application
Overview of the protocol is detailed in Appendix-A.
9
4208C-CAN-12/03
Several CAN message identifiers are defined to manage this protocol.
Identifier ID_SELECT_NODE ID_PROG_START ID_PROG_DATA ID_DISPLAY_DATA ID_WRITE_COMMAND ID_READ_COMMAND ID_ERROR Command Effect Open/Close a communication with a node Start a Flash/EEPROM programming Data for Flash/EEPROM programming Display data Write in XAF, or Hardware Byte Read from XAF or Hardware Byte and special data Error message from bootloader only Value [CRIS]0h [CRIS]1h [CRIS]2h [CRIS]3h [CRIS]4h [CRIS]5h [CRIS]6h
It is possible to allocate a new value for CAN ISP identifiers by writing the byte CRIS with the base value for the group of identifier. The maximum value for CRIS is 7Fh and the default CRIS value is 00h.
10
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
Figure 5. Identifier Remapping CAN Identifiers
7FFh
CAN ISP Identifiers
ID_ERROR
ID_READ_COMMAND ID_WRITE_COMMAND ID_DISPLAY_DATA ID_PROG_DATA ID_PROG_START ID_SELECT_NODE [CRIS]0h Group of 7 CAN Messages Used to Manage CAN ISP
000h
Communication Initialization
The communication with a device (CAN node) must be opened prior to initiating any ISP communication. To open the communication with the device, the Host sends a "connecting" CAN message (ID_SELECT_NODE) with the node number (NNB) passed in parameter. If the node number passed is equal to FFh then the CAN bootloader accepts the communication (Figure 6). Otherwise the node number passed in parameter must be equal to the local Node Number (Figure 7).
Figure 6. First Connection
Interface Board Between PC NNB = FFh (Default Value) and CAN Network Host Node 1
Figure 7. On Network Connection
NNB = 00h Node 0 Interface Board Between PC and CAN Network Host NNB = 01h Node 1 NNB = 03h Node 3 NNB = n Node n
Before opening a new communication with another device, the current device communication must be closed with its connecting CAN message (ID_SELECT_NODE).
11
4208C-CAN-12/03
Request from Host
Identifier ID_SELECT_NODE Length 1 Data[0] num_node
Note:
Num_node is the NNB (Node Number Byte) to which the Host wants to talk to.
Answers from Bootloader
Identifier ID_SELECT_NODE Length 2 Data[0] boot_version 01h Communication open Data[1] 00h Comment Communication close
Note:
Data[0] contains the bootloader version.
If the communication is closed then all the others messages won't be managed by bootloader.
ID_SELECT_NODE Flow Description Host
Send Select Node Message with Node Number in Parameter
Bootloader
ID_SELECT_NODE Message
Wait Select Node
OR
Node Select = FFh Node Select = Local Node Number
Time-out 10 ms
COMMAND ABORTED
State Com = Com Open
State com = com open State com = com closed
Read Bootloader Version Wait Select Node
ID_SELECT_NODE Message
COMMAND FINISHED
Send Bootloader Version and State of Communication
COMMAND FINISHED
ID_SELECT_NODE Example
identifier HOST BOOTLOADER ID_SELECT_NODE ID_SELECT_NODE length 01 02 data FF 01 01
12
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
Programming the Flash or EEPROM data The communication flow described above shows how to program data in the Flash memory or in the EEPROM data memory. This operation can be executed only with a device previously opened in communication. 1. The first step is to indicate which memory area (Flash or EEPROM data) is selected and the range address to program. 2. The second step is to transmit the data. The bootloader programs on a page of 128 bytes basis when it is possible. The host must take care of the following: * * * The data to program transmitted within a CAN frame are in the same page. To transmit 8 data bytes in CAN message when it is possible To start the programming operation, the Host sends a "start programming" CAN message (ID_PROG_START) with the area memory selected in data[0], the start address and the end address passed in parameter.
Requests from Host
Identifier ID_PROG_START Length 5 01h Data[0] 00h Address_start Address_end Data[1] Data[2] Data[3] Data[4]
Notes:
1. Data[0] chooses the area to program: - 00h: Flash - 01h: EEPROM data 2. Address_start gives the start address of the programming command. 3. Address_end gives the last address of the programming command.
Answers from Bootloader
The device has two possible answers: * * If the chip is protected from program access an "Error" CAN message is sent (see Section "Error Message Description", page 24). Otherwise an acknowledge is sent.
Identifier ID_PROG_START Length 0
The second step of the programming operation is to send data to program. Request from Host To send data to program, the Host sends a "programming data" CAN message (Id_prog_data) with up to 8 data by message and must wait for the answer of the device before sending the next data to program.
Identifier ID_PROG_DATA Length up to 8 Data[0] x ... ... Data[7]
x
13
4208C-CAN-12/03
Answers from Bootloader
The device has two possible answers: * * If the device is ready to receive new data, it sends a "programming data" CAN message (Id_prog_data) with the result Command_new passed in parameter. If the device has finished the programming, it sends a "programming data" CAN message (Id_prog_data) with the result Command_ok passed in parameter.
Identifier Length Data[0] 00h ID_PROG_DATA 1 01h 02h Description Command OK Command fail Command new data
ID_PROG_DATA Flow Description Host
Send Prog_Start Message with Addresses
Bootloader
ID_PROG_START Message
Wait Prog Start
OR Wait ERROR COMMAND ABORTED Wait ProgStart
SSB = Level 0
ID_ERROR Message ID_PROG_START Message
Send ERROR
Send ProgStart
Send Prog_Data message with 8 Datas
ID_PROG_DATA Message
Wait Data Prog
Column Latch Full
All bytes received
Wait Programming
All bytes received
OR Wait COMMAND_N
ID_PROG_DATA Message
Send COMMAND_NEW_DATA
Wait COMMAND_OK COMMAND FINISHED
ID_PROG_DATA Message
Send COMMAND_OK
COMMAND FINISHED
14
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
Programming Example
Reading the Flash or EEPROM Data
The ID_PROG_DATA flow described above allows the user to read data in the Flash memory or in the EEPROM data memory. A blank check command is possible with this flow. This operation can be executed only with a device previously opened in communication. To start the reading operation, the Host sends a "Display Data" CAN message (ID_DISPLAY_DATA) with the area memory selected, the start address and the end address passed in parameter. The device splits into blocks of 8 bytes the data to transfer to the Host if the number of data to display is greater than 8 data bytes.
Requests from Host
Identifier Length Data[0] 00h ID_DISPLAY_DATA 5 01h 02h Address_start Address_end Data[1] Data[2] Data[3] Data[4]
Notes:
Answers from Bootloader
The device has two possible answers: * * If the chip is protected from read access an "Error" CAN message is sent (see Section "Error Message Description", page 24). Otherwise, for a display command, the device starts to send the data up to 8 by frame to the host. For a blank check command the device sends a result OK or the first address not erased.
4208C-CAN-12/03
ytiruces etirw ni BSS htiw ,)hsalf eht ni h8000 ot h0000 morf h55 etirw( ataD gnimmargorP
HOST BOOTLOADER
1. Data[0] selects the area to read and the operation - 00h: Display Flash - 01h: Blank Check on the Flash - 02h: Display EEPROM data 2. The address_start gives the start address to read. 3. The address_end gives the last address to read.
yt ir uce s_r orre / /
)hsalf eht ni h8000 ot h0000 morf h55 etirw( ataD gnimmargorP
identifier control 05 00 08 01 01 01 HOST BOOTLOADER HOST BOOTLOADER HOST BOOTLOADER Id_prog_start Id_prog_start Id_prog_data Id_prog_data Id_prog_data Id_prog_data 00 00 55 02 55 00 identifier control 04 01 Id_prog_start Id_error 00 00 00
data 00 00 08
55 55 55 55 55 55 55 // command_new_data // command_ok
data
00 08
15
Answer to a read command:
Identifier ID_DISPLAY_DATA Length n data[n] x
Answer to a blank check command:
Identifier ID_DISPLAY_DATA 2 address_start Length 0 Data[0] Data[1] Description Blank Check OK
ID_DISPLAY_DATA Flow Description Host
Send Display_data Message with Addresses or Blank Check
Bootloader
ID_DISPLAY_DATA Message
Wait Display Data
OR
Wait ERROR
SSB = Level2
ID_ERROR Message
Send ERROR
COMMAND ABORTED
Blank Command
Read Data
All Data Read
nb Max by Frame
OR
Wait Data Display
ID_DISPLAY_DATA Message
Send DATA Read Verify Memory
All Data Read
All data read
COMMAND FINISHED
COMMAND FINISHED
Blank Check
OR
Wait COMMAND_OK
ID_DISPLAY_DATA Message ID_DISPLAY_DATA Message
Send COMMAND_KO
COMMAND FINISHED
Wait COMMAND_OK Send COMMAND_OK
COMMAND FINISHED
16
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
ID_Display_DATA Example
HOST BOOTLOADER BOOTLOADER
HOST BOOTLOADER
Programming Configuration Information
The ID_WRITE_COMMAND flow described below allows the user to program Configuration Information regarding the bootloader functionalities. This operation can be executed only with a device previously opened in communication. The Configuration Information can be divided in two groups: * Boot Process Configuration: - - - * BSB SBV Fuse bits (BLJB and X2 bits) (see Section "Mapping and Default Value of Hardware Security Byte", page 4) P1_CF, P3_CF, P4_CF BTC_1, BTC_2, BTC_3 SSB EB NNB CRIS
The CAN protocol configuration bytes are taken into account only after the next reset.
Note:
To start the programming operation, the Host sends a "write" CAN message (ID_WRITE_COMMAND) with the area selected, the value passed in parameter. Take care that the Program Fuse bit command programs the 4 Fuse bits at the same time.
4208C-CAN-12/03
)h8000 ot h0000 morf( ataD yalpsiD kcehC knalB
CAN Protocol Configuration: - - - - - -
identifier
control 05 08 01 00 55 55
data 00 55 00 00 08 55 55 55
Id_display_data Id_display_data Id_display_data
55
55 55
identifier Id_display_data Id_display_data
control 05 00
data 01 00 00 00 08 // Command OK
17
Requests from Host
Identifier Length Data[0] Data[1] 00h 01h 02h 03h 04h 05h 3 ID_WRITE_COMMAND 01h 06h 1Ch 1Dh 1Eh 1Fh 20h 2 02h value value write value in EB write value in BTC_1 write value in BTC_2 write value in BTC_3 write value in NNB write value in CRIS write value in Fuse bit Data[2] Description write value in BSB write value in SBV write value in P1_CF write value in P3_CF write value in P4_CF write value in SSB
Answers from Bootloader
The device has two possible answers: * * If the chip is protected from program access an "Error" CAN message is sent (see Section "Error Message Description", page 24). Otherwise an acknowledge "Command OK" is sent.
Identifier ID_WRITE_COMMAND Length 1 Data[0] 00h Description Command OK
18
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
ID_WRITE_COMMAND Flow Description Host
Send Write_Command
Bootloader
ID WRITE_COMMAND Message
Wait Write_Command
OR
Wait ERROR_SECURITY
NO_SECURITY
ID_ERROR Message
Send ERROR_SECURITY
COMMAND ABORTED
Write Data
Wait COMMAND_OK
ID_WRITE_COMMAND Message
Send COMMAND_OK
COMMAND FINISHED
COMMAND FINISHED
ID_WRITE_COMMAND Example
BOOTLOADER
BOOTLOADER
Reading Configuration Information or Manufacturer Information
4208C-CAN-12/03
hxF ta tib esuF etirW
h88 ta BSB etirW
HOST HOST
identifier Id_write_command Id_write_command
control 03 01
data 01 00 00 88
// command_ok
identifier
control 02 01 02 00
data F0 // command_ok
Id_write_command Id_write_command
The ID_READ_COMMAND flow described below allows the user to read the configuration or manufacturer information. This operation can be executed only with a device previously opened in communication. To start the reading operation, the Host sends a "Read Command" CAN message (ID_READ_COMMAND) with the information selected passed in data field.
19
Requests from Host
Identifier Length Data[0] Data[1] 00h 2 00h 01h 02h 00h 01h 02h 03h 04h 05h 06h ID_READ_COMMAND 1Ch 2 01h 1Dh 1Eh 1Fh 20h 30h 31h 60h 61h 2 02h 00h Read BTC_2 Read BTC_3 Read NNB Read CRIS Read Manufacturer Code Read Family Code Read Product Name Read Product Revision Read HSB (Fuse bits) Read BTC_1 Description Read Bootloader version Read Device ID1 Read Device ID2 Read BSB Read SBV Read P1_CF Read P3_CF Read P4_CF Read SSB Read EB
Answers from Bootloader
The device has two possible answers: * * If the chip is protected from read access an "Error" CAN message is sent (see Section "Error Message Description", page 24). Otherwise the device answers with a Read Answer CAN message (ID_READ_COMMAND).
Identifier ID_READ_COMMAND Length 1 Data[n] value
20
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
Flow Description Host
Send read_com message
Bootloader
ID_READ_COM MESSAGE
Wait Read_Com
OR
Wait ERROR_SECURITY
RD_WR_SECURITY
ID_ERROR MESSAGE
Send ERROR_SECURITY
COMMAND ABORTED
Read Data
Wait Value of data
ID_READ_COM MESSAGE
Send Data read
COMMAND FINISHED
COMMAND FINISHED
ID_READ_COMMAND Example
HOST BOOTLOADER
BOOTLOADER
BOOTLOADER
4208C-CAN-12/03
noisreV redaoltooB daeR tib esuF daeR VBS daeR
HOST HOST
identifier
control 02 01
data 00 55 00 // Bootloader version 55h
Id_read_command Id_read_command
identifier Id_read_command Id_read_command
control 02 01 01 F5
data 01 // SBV = F5h
identifier Id_read_command Id_read_command
control 01 01 02 F0
data
// Fuse bit = F0h
21
Erasing the Flash
The ID_WRITE_COMMAND flow described below allows the user to erase the Flash memory. This operation can be executed only with a device previously opened in communication. Two modes of Flash erasing are possible: * * Full-chip erase Block erase
The Full-chip erase command erases the whole Flash (16 Kbytes) and sets some Configuration Bytes to their default values: * * * BSB = FFh SBV = FFh SSB = FFh (NO_SECURITY)
Take care that the full chip erase execution takes few seconds (128 pages)
Note:
The Block erase command erases only a part of the Flash. Two Blocks are defined in the T89C51CC02: * * block0 (from 0000h to 1FFFh) block1 (from 2000h to 3FFFh)
To start t he erasing operation, the Host sends a "write" CA N mes sage (ID_WRITE_COMMAND). Requests from Host
Identifier Length Data[0] Data[1] 00h ID_WRITE_COMMAND 2 00h 20h FFh Description Erase block0 (0K to 8K) Erase block1 (8K to 16K) Full chip erase
Answers from Bootloader
As the Program Configuration Information flows, the erase block command has two possible answers: * * If the chip is protected from program access an "Error" CAN message is sent (see Section "Error Message Description", page 24). Otherwise an acknowledge is sent.
The full chip erase is always executed whatever the Software Security Byte value is. On a full chip erase command an acknowledge "Command OK" is sent.
Identifier ID_WRITE_COMMAND
Length 1
data[0] 00h
Description Command OK
22
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
ID_WRITE_COMMAND Example
HOST BOOTLOADER
4208C-CAN-12/03
esarE pihc-lluF
identifier Id_write_command Id_write_command
control 02 01
data 00 00 FF // command_ok
23
Starting the Application
The ID_WRITE_COMMAND flow described below allows to start the application directly from the bootloader upon a specific command reception. This operation can be executed only with a device previously opened in communication. Two options are possible: * Start the application with a reset pulse generation (using watchdog). When the device receives this command the watchdog is enabled and the bootloader enters a waiting loop until the watchdog resets the device. Take care that if an external reset chip is used the reset pulse in output may be wrong and in this case the reset sequence is not correctly executed. Start the application without reset A jump at the address 0000h is used to start the application without reset.
*
To start the ap plication , th e Host sends a "Start Ap plication" CAN messa ge (ID_WRITE_COMMAND) with the corresponding option passed in parameter. Requests from Host
Identifier Length 2 ID_WRITE_COMMAND 4 03h 01h address Start Application with a jump at "address" Data[0] Data[1] 00h Data[2] Data[3] Description Start Application with a reset pulse generation
Answer from Bootloader ID_WRITE_COMMAND Example
No answer is returned by the device.
HOST BOOTLOADER
Error Message Description
The error message is implemented to report when an action required is not possible. * At the moment only the security error is implemented and only the device can answer this kind of CAN message (ID_ERROR).
Identifier ID_ERROR Length 1 Data[0] 00h Description Software Security Error
24
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
noitacilppa tratS
identifier Id_write_command No answer
control 04
data 03 01 00 00
T89C51CC02 CAN Bootloader
In-Application Programming/Selfprogramming
The IAP allows to reprogram a microcontroller's on-chip Flash memory without removing it from the system and while the embedded application is running. The user application can call some Application Programming Interface (API) routines allowing IAP. These API are executed by the bootloader. To call the corresponding API, the user must use a set of Flash_api routines which can be linked with the application. Example of Flash_api routines are available on the Atmel web site on the application note: C Flash Drivers for the T89C51CC02CA The Flash_api routines on the package work only with the CAN bootloader. The Flash_api routines are listed in Appendix-B.
API Call
Process The application selects an API by setting the 4 variables available when the Flash_api library is linked to the application. These four variables are located in RAM at fixed address: * * * * api_command: 1Ch api_value:1Dh api_dph: 1Eh api_dpl: 1Fh
All calls are made through a common interface "USER_CALL" at the address FFF0h. The jump at the USER_CALL must be done by LCALL instruction to be able to comeback in the application. Before jump at the USER_CALL, the bit ENBOOT in AUXR1 register must be set. Constraints The interrupts are not disabled by the bootloader. Interrupts must be disabled by user prior to jump to the USER_CALL, then re-enabled when returning. Interrupts must also be disabled before accessing EEPROM data then re-enabled after. The user must take care of hardware watchdog before launching a Flash operation. For more information regarding the Flash writing time see the T89C51CC02 datasheet.
25
4208C-CAN-12/03
API Commands
Several types of APIs are available: * * * * * Read/Program Flash and EEPROM Data memory Read Configuration and Manufacturer Information Program Configuration Information Erase Flash Start Bootloader
Read/Program Flash and EEPROM Data Memory
All routines to access EEPROM Data are managed directly from the application without using bootloader resources. The bootloader is not used to read the Flash memory. For more details on these routines see the T89C51CC02 datasheet sections "Program/Code Memory" and "EEPROM Data Memory". Two routines are available to program the Flash: - - * __api_wr_code_byte __api_wr_code_page
The application program loads the column latches of the Flash then calls the __api_wr_code_byte or __api_wr_code_page see datasheet in section "Program/Code Memory". Parameter Settings
API_name __api_wr_code_byte __api_wr_code_page api_command 0Dh api_dph api_dpl api_value -
*
*
Instruction: LCALL FFF0h.
No special resources are used by the bootloader during this operation
Note:
Read Configuration and Manufacturer Information
*
Parameter Settings
API_name __api_rd_HSB __api_rd_BSB __api_rd_SBV __api_rd_SSB __api_rd_EB __api_rd_CANBTC1 __api_rd_CANBTC2 __api_rd_CANBTC3 __api_rd_NNB __api_rd_CRIS __api_rd_manufacturer __api_rd_device_id1 api_command 08h 05h 05h 05h 05h 05h 05h 05h 05h 05h 05h 05h api_dph api_dpl 00h 00h 01h 05h 06h 1Ch 1Dh 1Eh 1Fh 20h 30h 31h api_value return HSB return BSB return SBV return SSB return EB return CANBTC1 return CANBTC2 return CANBTC3 return NNB return CRIS return manufacturer id return id1
26
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
API_name __api_rd_device_id2 __api_rd_device_id3 __api_rd_bootloader_version api_command 05h 05h 0Eh api_dph api_dpl 60h 61h 00h api_value return id2 return id3 return value
* *
Instruction: LCALL FFF0h. At the complete API execution by the bootloader, the value to read is in the api_value variable.
No special resources are used by the bootloader during this operation
Note:
Program Configuration Information
*
Parameter Settings
API_name __api_clr_X2 __api_set_X2 __api_wr_BSB __api_wr_SBV __api_wr_SSB __api_wr_EB __api_wr_CANBTC1 __api_wr_CANBTC2 __api_wr_CANBTC3 __api_wr_NNB __api_wr_CRIS api_command 07h 07h 04h 04h 04h 04h 04h 04h 04h 04h 04h api_dph api_dpl 00h 01h 05h 06h 1Ch 1Dh 1Eh 1Fh 20h api_value (HSB & 7Fh) | 80h HSB & 7Fh value to write value to write value to write value to write value to write value to write value to write value to write value to write
*
Instruction: LCALL FFF0h.
1. See in the T89C51CC02 datasheet the time required for a write operation. 2. No special resources are used by the bootloader during these operations.
Note:
Erasing Flash
The T89C51CC02 Flash memory is divided in two blocks of 8K Bytes: - - * Block 0: from address 0000h to 1FFFh Block 1: from address 2000h to 3FFFh
These two blocks contain 64 pages. Parameter Settings
API_name __api_erase_block0 __api_erase_block1 api_command 00h 00h api_dph 00h 20h api_dpl api_value -
*
Instruction: LCALL FFF0h.
1. See the T89C51CC02 datasheet for the time that a write operation takes and this time must multiply by 64 (number of page). 2. No special resources are used by the bootloader during these operations
Note:
27
4208C-CAN-12/03
Starting the Bootloader
There are two start bootloader routines possible: 1. This routine allows to start at the beginning of the bootloader or after a reset. After calling this routine the regular boot process is performed and the communication must be opened before any action. * * * No special parameter setting Set bit ENBOOT in AUXR1 register Instruction: LJUMP or LCALL at address F800h
2. This routine allows to start the bootloader with the CAN bit configuration of the application and start with the state `Communication Open'. That means the bootloader will return the message `ID_SELECT_NODE' with the field com port open. * * * No special parameter setting Set bit ENBOOT in AUXR1 register Instruction: LJUMP or LCALL at address FF00h
28
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
Appendix-A
Table 1. Summary of Frames from Host
Identifier ID_SELECT_NODE (CRIS:0h) ID_PROG_START (CRIS:1h) ID_PROG_DATA (CRIS:2h) Length 1 Data[0] num node 00h 5 01h n 00h ID_DISPLAY_DATA (CRIS:3h) 5 01h 02h 00h 2 00h 20h FFh 00h 01h 02h 03h 04h 05h ID_WRITE_COMMAND (CRIS:4h) 3 01h 06h 1Ch 1Dh 1Eh 1Fh 20h 3 2 03h 4 01h address 02h 00h 00h value value Write value in EB Write BTC_1 Write BTC_2 Write BTC_3 Write NNB Write CRIS Write value in Fuse (HWB) Start Application with Hardware Reset Start Application by LJMP address start_address end_address data[0:8] start_address end_address Init EEPROM programming Data to program Display Flash Data Blank Check in Flash Display EEPROM Data Erase block0 (0K to 8K) Erase block1 (8K to 16K) Full chip Erase Write value in BSB Write value in SBV Write P1_CF Write P3_CF Write P4_CF Write value in SSB Data[1] Data[2] Data[3] Data[4] Description Open/Close communication Init Flash programming
29
4208C-CAN-12/03
Table 1. Summary of Frames from Host (Continued)
Identifier Length Data[0] Data[1] 00h 2 00h 01h 02h 00h 01h 02h 03h 04h 05h ID_READ_COMMAND (CRIS:5h) 2 01h 31h 60h 61h 1Ch 1Dh 1Eh 1Fh 20h 2 02h 00h Read Family Code Read Product Name Read Product Revision Read BTC_1 Read BTC_2 Read BTC_3 Read NNB Read CRIS Read HSB 06h 30h Data[2] Data[3] Data[4] Description Read Bootloader Version Read Device ID1 Read Device ID2 Read BSB Read SBV Read P1_CF Read P3_CF Read P4_CF Read SSB Read EB Read Manufacturer Code
30
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
Table 2. Summary of Frames from Target (Bootloader)
Identifier ID_SELECT_NODE (CRIS:0h) ID_PROG_START (CIRS:1h) Length 2 Data[0] Boot version Data[1] 00h 01h Data[2] n data (n = 0 to 8) Data[3] Data[4] Description Communication close Communication open Command OK Command OK Command fail Command New Data Data read Blank Check OK Blank Check fail Command OK
0
00h
ID_PROG_DATA (CRIS:2h)
1
01h 02h
n ID_DISPLAY_DATA (CRIS:3h) 0 2 ID_WRITE_COMMAND (CIRS:4h) ID_READ_COMMAND (CRIS:5h) ID_ERROR (CRIS:6h) 1
first address not blank 00h -
1
Value
-
-
-
Read Value
1
00h
-
-
-
-
Software Security Error
31
4208C-CAN-12/03
Appendix-B
Table 3. API Summary
Function Name __api_rd_code_byte __api_wr_code_byte __api_wr_code_page __api_erase_block0 __api_erase_block1 __api_rd_HSB __api_clr_X2 __api_set_X2 __api_rd_BSB __api_wr_BSB __api_rd_SBV __api_wr_SBV __api_erase_SBV __api_rd_SSB __api_wr_SSB __api_rd_EB __api_wr_EB __api_rd_CANBTC1 __api_wr_CANBTC1 __api_rd_CANBTC2 __api_wr_CANBTC2 __api_rd_CANBTC3 __api_wr_CANBTC3 __api_rd_NNB __api_wr_NNB __api_rd_CRIS __api_wr_CRIS __api_rd_manufacturer __api_rd_device_id1 __api_rd_device_id2 __api_rd_device_id3 __api_rd_bootloader_version Bootloader Execution no yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes 0Dh 0Dh 00h 00h 08h 07h 07h 05h 04h 05h 04h 04h 05h 04h 05h 04h 05h 04h 05h 04h 05h 04h 05h 04h 05h 04h 05h 05h 05h 05h 0Eh 00h 20h 00h 00h 00h 00h 00h 01h 01h 01h 05h 05h 06h 06h 1Ch 1Ch 1Dh 1Dh 1Eh 1Eh 1Fh 1Fh 20h 20h 30h 31h 60h 61h 00h return value (HSB & 7Fh) | 80h HSB & 7Fh return value value return value value FFh return value value return value value return value value return value value return value value return value value return value value return value return value return value return value return value api_command api_dph api_dpl api_value
32
T89C51CC02 CAN Bootloader
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
Table 3. API Summary (Continued)
Function Name __api_eeprom_busy __api_rd_eeprom_byte __api_wr_eeprom_byte __api_start_bootloader __api_start_isp Bootloader Execution no no no no no api_command api_dph api_dpl api_value -
Datasheet Change Log
Changes from 4208B 04/03 to 42108C - 12/03
1. Clarified explanation regarding full chip erase. See "Erasing Flash" on page 27.
33
4208C-CAN-12/03
T89C51CC02 CAN Bootloader
Table of Contents
Features ................................................................................................. 1 Description ............................................................................................ 1 Functional Description......................................................................... 2
In-System Programming Capability ...................................................................... 2 In-Application Programming or Self- programming Capability.............................. 2 Block Diagram ...................................................................................................... 2 Bootloader Configuration ...................................................................................... 3 Security ................................................................................................................. 4 Software Boot Vector.............................................................................................5 FLIP Software Program ........................................................................................ 5
In-System Programming (ISP) ............................................................. 6
Boot Process ........................................................................................................ 6 Physical Layer .......................................................................................................8 Protocol................................................................................................................. 9
In-Application Programming/Self-programming ............................. 25
API Call............................................................................................................... 25 API Commands....................................................................................................26
Appendix-A.......................................................................................... 29 Appendix-B.......................................................................................... 32 Datasheet Change Log ....................................................................... 33
Changes from 4208B - 04/03 to 42108C - 12/03................................................ 33
i
4208C-CAN-12/03
Atmel Headquarters
Corporate Headquarters
2325 Orchard Parkway San Jose, CA 95131 TEL 1(408) 441-0311 FAX 1(408) 487-2600
Atmel Operations
Memory
2325 Orchard Parkway San Jose, CA 95131 TEL 1(408) 441-0311 FAX 1(408) 436-4314
RF/Automotive
Theresienstrasse 2 Postfach 3535 74025 Heilbronn, Germany TEL (49) 71-31-67-0 FAX (49) 71-31-67-2340 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906 TEL 1(719) 576-3300 FAX 1(719) 540-1759
Europe
Atmel Sarl Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland TEL (41) 26-426-5555 FAX (41) 26-426-5500
Microcontrollers
2325 Orchard Parkway San Jose, CA 95131 TEL 1(408) 441-0311 FAX 1(408) 436-4314 La Chantrerie BP 70602 44306 Nantes Cedex 3, France TEL (33) 2-40-18-18-18 FAX (33) 2-40-18-19-60
Asia
Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimhatsui East Kowloon Hong Kong TEL (852) 2721-9778 FAX (852) 2722-1369
Biometrics/Imaging/Hi-Rel MPU/ High Speed Converters/RF Datacom
Avenue de Rochepleine BP 123 38521 Saint-Egreve Cedex, France TEL (33) 4-76-58-30-00 FAX (33) 4-76-58-34-80
ASIC/ASSP/Smart Cards
Zone Industrielle 13106 Rousset Cedex, France TEL (33) 4-42-53-60-00 FAX (33) 4-42-53-60-01 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906 TEL 1(719) 576-3300 FAX 1(719) 540-1759 Scottish Enterprise Technology Park Maxwell Building East Kilbride G75 0QR, Scotland TEL (44) 1355-803-000 FAX (44) 1355-242-743
Japan
9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan TEL (81) 3-3523-3551 FAX (81) 3-3523-7581
e-mail
literature@atmel.com
Web Site
http://www.atmel.com
Disclaimer: Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company's standard warranty which is detailed in Atmel's Terms and Conditions located on the Company's web site. The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel's products are not authorized for use as critical components in life support devices or systems. (c) Atmel Corporation 2003. All rights reserved. Atmel (R) and combinations thereof are the registered trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be the trademarks of others.
Printed on recycled paper.
4208C-CAN-12/03 /xM


▲Up To Search▲   

 
Price & Availability of T89C51CC020312

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X